package com.sky.mapper;

import com.sky.dto.CategoryDTO;
import com.sky.dto.CategoryPageQueryDTO;
import com.sky.entity.Category;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CategoryMapper {
    //分类分页
    List<Category> findByPage(CategoryPageQueryDTO categoryPageQueryDTO);

    //通过分类名查询
    String findByname = "SELECT * FROM category WHERE name=#{name}";
    @Select(findByname)
    Category findByname(String name);

    //添加
    void insert(Category category);

    //删除
    String deleteById = "DELETE FROM category WHERE id=#{id}";
    @Delete(deleteById)
    void deleteById(Long id);

    //修改
    void updateById(Category category);

    // 条件查询
    List<Category> getParamList(CategoryDTO categoryDTO);
}
